<ui:composition template="/template/twocolumn2.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="conteudo">
		<div id="form_style">
		  <div class="cadastro">
			<h3>Novo post</h3>
			<h:form id="form">
				<p:messages id="messages" showDetail="false" globalOnly="true"
					autoUpdate="true" closable="true" />
				<h:panelGrid id="pgcadastro" columns="3">

					<h:outputLabel id="ltitulo"
						value="#{Message['label.post.titulo']}:" />
					<h:inputText value="#{postMB.post.titulo}" id="titulo"  required="true"
					requiredMessage="Informe o título"/>
					<h:message for="titulo" errorStyle="color:red" />

					<h:outputLabel id="lconteudo"
						value="#{Message['label.post.conteudo']}:" />
					<h:inputTextarea id="conteudo" value="#{postMB.post.conteudo}"
						style="width:100%;" required="true" requiredMessage="Informa o conteúdo"/>
					<h:message for="conteudo" errorStyle="color:red" />

					<h:outputLabel id="ltipo" value="#{Message['label.post.tipo']}:" />
					<h:selectOneMenu style="width:50%" id="tipo"
						value="#{postMB.tipoPost}">
						<f:selectItem itemLabel="-- Selecione --" noSelectionOption="true" />
						<f:selectItems value="#{postMB.tipoPostItens}" var="tipo"
							itemLabel="#{tipo.valor}" itemValue="#{tipo.chave}" />
					</h:selectOneMenu>
					<h:message for="tipo" errorStyle="color:red" />

					<h:outputLabel id="lstatus"
						value="#{Message['label.post.status']}:" />
					<h:selectOneMenu style="width:50%" id="status"
						value="#{postMB.statusPost}">
						<f:selectItem itemLabel="-- Selecione --" noSelectionOption="true" />
						<f:selectItems value="#{postMB.statusPostItens}" var="status"
							itemLabel="#{status.valor}" itemValue="#{status.chave}" />
					</h:selectOneMenu>
					<h:message for="status" errorStyle="color:red" />
				</h:panelGrid>

				<h:outputLabel id="ldtinicial"
					value="#{Message['label.post.datainicial']}:" />
				<p:calendar id="dtInicial" value="#{postMB.post.dataInicial}"  required="true"
				requiredMessage="Informe a data inicial"/>
				<h:message for="dtInicial" errorStyle="color:red" />

				<h:outputLabel id="ldtFinal"
					value="#{Message['label.post.datafinal']}:" />
				<p:calendar id="dtFinal" value="#{postMB.post.dataFinal}" required="true"
				requiredMessage="Informe a data final"/>
				<h:message for="dtFinal" errorStyle="color:red" />




				<p:toolbar>
					<p:toolbarGroup align="left">
						<p:commandButton value="Salvar" action="#{postMB.adicionarPost}"
							ajax="false" icon="ui-icon-check" validateClient="true" />
						<p:commandButton value="Limpar" type="reset" ajax="false"
							icon="ui-icon-clear" />
					</p:toolbarGroup>
				</p:toolbar>
			</h:form>
			</div>
		</div>
	</ui:define>

</ui:composition>